package com.yukang.guahao.service;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class GroupService {
   public static String getGroup() {
      Process proc;
      try {
         proc = Runtime.getRuntime().exec("python py_bin/air_data.py");
         BufferedReader input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
         BufferedReader errMsg = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
         String err;
         String result = input.readLine();
         System.out.println(result);
         System.out.println("Error:\n");
         while ((err = errMsg.readLine()) != null) {
            System.out.println(err);
         }

         System.out.println(err);
         input.close();
         proc.waitFor();
         return result;
      } catch (Exception e) {
         e.printStackTrace();
      }
      return null;
   }
}
